citation = function ()
{
require(grid)
require(gridExtra)
grid.text("www.RxWiki.com | 2015",
x = unit(0.97, "npc"), y = unit(0.03, "npc"), just = c("right", "bottom"),
gp = gpar(fontface = "bold", fontsize = 14, col = "grey"))
grid.text("Hunter Ratliff | hunter@rxwiki.com",
x = unit(0.03, "npc"), y = unit(0.03, "npc"), just = c("left", "bottom"),
gp = gpar(fontsize = 10, col = "grey"))
# grid.text("2015-10-21",
# x = unit(0.03, "npc"), y = unit(0.97, "npc"), just = c("left", "top"),
# gp = gpar(fontsize = 12, col = "grey"))
}
Here’s our data frame
head(geodata)
## Name Account.Category Date.Subscribed
## 1 GenoRite Pharmacy Affiliate 2014-05-27
## 2 Paul's Pharmacy - Manhattan, KS Affiliate 2014-06-19
## 3 Langhorne Pharmacy Affiliate 2014-06-19
## 4 Pascack Pharmacy Affiliate 2014-05-20
## 5 X-tra Discount Drugs Affiliate 2014-05-23
## 6 Trott's Call Field Drug Affiliate 2014-06-26
## ID Config.ID Subscription.Status
## 1 6dce138a-0224-ef38-bbb1-5384ba6fc763 5123519160 NA
## 2 c1bc0ac3-df7d-24d3-1671-537d0c1276b1 7855391717 NA
## 3 d7e55c5a-6f11-3af2-c40e-52b8878d452e 2157521100 NA
## 4 e89a82a1-9bab-dd67-044e-535976a01dac 2016645500 NA
## 5 8e787d2d-b963-8854-b6c1-53597583a0ef 8137887885 NA
## 6 31b847da-aa9b-eb92-1532-53597667e037 9406921234 NA
## Subscription.Opportunity Subscription.Fee Twitter mon zip
## 1 872 Yes May 78745
## 2 872 Yes Jun 66502
## 3 872 Yes Jun 19047
## 4 872 Yes May 07642
## 5 872 Yes May 33542
## 6 Pro Yearly 690 No Jun 76308
## city state latitude longitude
## 1 Austin TX 30.20756 -97.79575
## 2 Manhattan KS 39.18499 -96.56932
## 3 Langhorne PA 40.17356 -74.91203
## 4 Hillsdale NJ 41.00739 -74.04247
## 5 Zephyrhills FL 28.23849 -82.18191
## 6 Wichita Falls TX 33.85980 -98.54064
## Map 1
USA + geom_jitter(aes(x = longitude, y = latitude, color=Twitter), alpha = 0.3, data = geodata) + theme_map() + ggtitle("Who has a Twitter?")
## Warning: Removed 49 rows containing missing values (geom_point).
citation()
## Map 2
USA + geom_jitter(aes(x = longitude, y = latitude, color=Account.Category), alpha = 0.5, data = geodata) + theme_map() + ggtitle("Geography By Account Category")
## Warning: Removed 49 rows containing missing values (geom_point).
citation()
## Map 3
USA + geom_jitter(aes(x = longitude, y = latitude, color=Subscription.Opportunity), alpha = 0.5, data = geodata) + theme_excel()
## Warning: Removed 49 rows containing missing values (geom_point).
citation()
## Map 4
USA + geom_jitter(aes(x = longitude, y = latitude, color=mon), alpha = 0.5, data = geodata) + theme_excel()
## Warning: Removed 49 rows containing missing values (geom_point).
citation()
## Map 5
USA + geom_jitter(aes(x = longitude, y = latitude, color=mon), alpha = 0.5, data = geodata) + theme_excel()+ facet_wrap("Subscription.Opportunity")
## Warning: Removed 29 rows containing missing values (geom_point).
## Warning: Removed 5 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 4 rows containing missing values (geom_point).
## Warning: Removed 7 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_point).
citation()
## Map 6
USA + stat_density2d(aes(x = longitude, y = latitude), geom = "contour", data = geodata, alpha=.8, color=I("#F05B49")) +
stat_density2d(aes(x = longitude, y = latitude), geom = "polygon", data = geodata, alpha=.18) +
# stat_density2d(aes(x = longitude, y = latitude), geom = "point", data = geodata, alpha=.15) +
geom_jitter(aes(x = longitude, y = latitude), alpha = 0.18, data = geodata, color=I("#00A2A0")) + theme_map() + ggtitle("Independent pharmacies utilizing RxWiki")
## Warning: Removed 49 rows containing non-finite values (stat_density2d).
## Warning: Removed 49 rows containing non-finite values (stat_density2d).
## Warning: Removed 49 rows containing missing values (geom_point).
citation()